import pytest
import json
import logging

from common.request_util_test import RequestUtil
from common.test_yaml_util_test import YamlUtil
from config import datas
from datetime import datetime, timedelta

class TestNode:
    @pytest.mark.parametrize('nodesinfo',YamlUtil().read_testcase_yaml('v23.12/1_get_all_nodes.yaml'))
    def test_get_all_nodes(self,nodesinfo,get_env_info):
        baseUrl = get_env_info
        url = baseUrl+nodesinfo['request']['url']
        method = nodesinfo['request']['method']
        req = RequestUtil().send_request(method,url)
        logging.debug(nodesinfo['name'])
        logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 200


    @pytest.mark.parametrize('nodeinfo',YamlUtil().read_testcase_yaml('v23.12/2_get_one_node.yaml'))
    def test_get_one_node(self,nodeinfo,get_env_info):
        hostname = datas.hostname
        baseUrl = get_env_info
        url = baseUrl+nodeinfo['request']['url'].replace('{hostname}',hostname)
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method,url)
        logging.debug(nodeinfo['name'])
        logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodeinfo',YamlUtil().read_testcase_yaml('v23.12/get_node_labels.yaml'))
    def test_get_node_labels(self,nodeinfo,get_env_info):
        hostname = datas.hostname
        baseUrl = get_env_info
        url = baseUrl+nodeinfo['request']['url']+hostname
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method,url)
        data = YamlUtil().read_testcase_yaml('create_node_labels.yaml')
        #print(type(json.loads(req.text)['metadata']['labels']))
        data[0]['request']['data']['metadata']['labels'] = json.loads(req.text)['metadata']['labels']
        YamlUtil().write_yaml("create_node_labels.yaml",data)
        logging.debug(nodeinfo['name'])
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodeinfo',YamlUtil().read_testcase_yaml('v23.12/create_node_labels.yaml'))
    def test_create_node_labels(self,nodeinfo,get_env_info):
        hostname = datas.hostname
        baseUrl = get_env_info
        url = baseUrl+nodeinfo['request']['url']+hostname
        header = {'Content-Type' : 'application/merge-patch+json'}
        method = nodeinfo['request']['method']
        data = nodeinfo['request']['data']
        data['metadata']['labels']['test123'] = 'test123'
        req = RequestUtil().send_request(method,url,headers=header,json=data)
        logging.debug(nodeinfo['name'])
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodeinfo',YamlUtil().read_testcase_yaml('v23.12/create_node_labels.yaml'))
    def test_remove_node_labels(self,nodeinfo,get_env_info):
        hostname = datas.hostname
        baseUrl = get_env_info
        url = baseUrl+nodeinfo['request']['url']+hostname
        header = {'Content-Type' : 'application/merge-patch+json'}
        method = nodeinfo['request']['method']
        data = nodeinfo['request']['data']
        data['metadata']['labels']['test123'] = None
        req = RequestUtil().send_request(method,url,headers=header,json=data)
        logging.debug(nodeinfo['name'])
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodeinfo',YamlUtil().read_testcase_yaml('v23.12/get_prometheus_cpu_1h.yaml'))
    def test_get_prometheus_cpu_1h(self,nodeinfo,get_env_info):
        hostname = datas.hostname
        baseUrl = get_env_info
        time1 = datetime.now()
        time2 = time1 - timedelta(hours=1)
        desired_format = "%Y-%m-%d %H:%M:%S"
        time1 = time1.strftime(desired_format)
        time2 = time2.strftime(desired_format)
        url = baseUrl + nodeinfo['request']['url'].replace('{time1}', time1).replace('{time2}', time2).replace('{hostname}',hostname)
        #print(url)
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method,url)
        logging.debug(nodeinfo['name'])
        #logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 200


    @pytest.mark.parametrize('nodeinfo',YamlUtil().read_testcase_yaml('v23.12/3_get_resources_not_exist.yaml'))
    def test_get_resources_not_exist(self,nodeinfo,get_env_info):
        #hostname = datas.hostname
        baseUrl = get_env_info
        url = baseUrl+nodeinfo['request']['url']#.replace('{hostname}',hostname)
        logging.debug(nodeinfo['name'])
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method,url)
        assert req.status_code == 400


    @pytest.mark.parametrize('nodeinfo',YamlUtil().read_testcase_yaml('v23.12/4_get_pagination_page=2.yaml'))
    def test_get_pagination_page(self,nodeinfo,get_env_info):
        baseUrl = get_env_info
        url = baseUrl+nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method,url)
        logging.debug(nodeinfo['name'])
        logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodeinfo', YamlUtil().read_testcase_yaml('v23.12/5_get_pagination_page&error.yaml'))
    def test_get_pagination_pageerror(self, nodeinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodeinfo['name'])
        logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 200


    @pytest.mark.parametrize('nodeinfo', YamlUtil().read_testcase_yaml('v23.12/6_get_namespace_pods.yaml'))
    def test_get_namespace_pods(self, nodeinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodeinfo['name'])
        logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodeinfo', YamlUtil().read_testcase_yaml('v23.12/7_get_namespace_deoloyments.yaml'))
    def test_get_namespace_deoloyments(self, nodeinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodeinfo['name'])
        logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodeinfo', YamlUtil().read_testcase_yaml('v23.12/8_get_namespaces_not_exist.yaml'))
    def test_get_namespaces_not_exist(self, nodeinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodeinfo['name'])
        logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 200


    @pytest.mark.parametrize('nodeinfo', YamlUtil().read_testcase_yaml('v23.12/9_get_pods_not_exist.yaml'))
    def test_get_pods_not_exist(self, nodeinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodeinfo['name'])
        #logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 400


    @pytest.mark.parametrize('nodeinfo', YamlUtil().read_testcase_yaml('v23.12/10_get_resources_pod.yaml'))
    def test_get_resources_pod(self, nodeinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodeinfo['name'])
        logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodeinfo', YamlUtil().read_testcase_yaml('v23.12/11_get_resources_pod_not.yaml'))
    def test_get_resources_pod_not(self, nodeinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodeinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 500

    @pytest.mark.parametrize('nodeinfo', YamlUtil().read_testcase_yaml('v23.12/12_get_resources_namespace_not.yaml'))
    def test_get_resources_namespace_not(self, nodeinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodeinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 500


    @pytest.mark.parametrize('nodesinfo', YamlUtil().read_testcase_yaml('v23.12/13_get_hub_all_nodes.yaml'))
    def test_get_hub_all_nodes(self, nodesinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodesinfo['request']['url']
        method = nodesinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodesinfo['name'])
        logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodesinfo', YamlUtil().read_testcase_yaml('v23.12/14_get_hub_all_pods.yaml'))
    def test_get_hub_all_pods(self, nodesinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodesinfo['request']['url']
        method = nodesinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodesinfo['name'])
        logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodesinfo', YamlUtil().read_testcase_yaml('v23.12/15_get_hub_not_exist.yaml'))
    def test_get_hub_not_exist(self, nodesinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodesinfo['request']['url']
        method = nodesinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodesinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 500

    @pytest.mark.parametrize('nodesinfo', YamlUtil().read_testcase_yaml('v23.12/16_get_helm_repo.yaml'))
    def test_get_helm_repo(self, nodesinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodesinfo['request']['url']
        method = nodesinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodesinfo['name'])
        logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodeinfo',YamlUtil().read_testcase_yaml('v23.12/17_helm_repo_add.yaml'))
    def test_helm_repo_add(self,nodeinfo,get_env_info):
        baseUrl = get_env_info
        url = baseUrl+nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        data = nodeinfo['request']['data']
        headers = {'Content-Type': 'application/json'}
        req = RequestUtil().send_request(method,url,json=data,headers=headers)
        logging.debug(nodeinfo['name'])
        logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodeinfo',YamlUtil().read_testcase_yaml('v23.12/17_helm_repo_add.yaml'))
    def test_helm_repo_add_allready(self,nodeinfo,get_env_info):
        baseUrl = get_env_info
        url = baseUrl+nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        data = nodeinfo['request']['data']
        headers = {'Content-Type': 'application/json'}
        req = RequestUtil().send_request(method,url,json=data,headers=headers)
        logging.debug(nodeinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 500

    @pytest.mark.parametrize('nodeinfo',YamlUtil().read_testcase_yaml('v23.12/18_helm_repo_del.yaml'))
    def test_helm_repo_del(self,nodeinfo,get_env_info):
        baseUrl = get_env_info
        url = baseUrl+nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method,url)
        logging.debug(nodeinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodesinfo', YamlUtil().read_testcase_yaml('v23.12/19_get_helm_find_repo.yaml'))
    def test_get_helm_find_repo(self, nodesinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodesinfo['request']['url']
        method = nodesinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodesinfo['name'])
        logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodeinfo',YamlUtil().read_testcase_yaml('v23.12/20_helm_repo_add_error.yaml'))
    def test_helm_repo_add_error(self,nodeinfo,get_env_info):
        baseUrl = get_env_info
        url = baseUrl+nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        data = nodeinfo['request']['data']
        headers = {'Content-Type': 'application/json'}
        req = RequestUtil().send_request(method,url,json=data,headers=headers)
        logging.debug(nodeinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 500


    @pytest.mark.parametrize('nodesinfo', YamlUtil().read_testcase_yaml('v23.12/21_get_helm_sync_repo.yaml'))
    def test_get_helm_sync_repo(self, nodesinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodesinfo['request']['url']
        method = nodesinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodesinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodesinfo', YamlUtil().read_testcase_yaml('v23.12/22_get_helm_sync_openfuyao.yaml'))
    def test_get_helm_sync_openfuyao(self, nodesinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodesinfo['request']['url']
        method = nodesinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodesinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodesinfo', YamlUtil().read_testcase_yaml('v23.12/23_get_helm_sync_not_exist.yaml'))
    def test_get_helm_sync_not_exist(self, nodesinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodesinfo['request']['url']
        method = nodesinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodesinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 500


    @pytest.mark.parametrize('nodesinfo', YamlUtil().read_testcase_yaml('v23.12/24_get_helm_chart.yaml'))
    def test_get_helm_chart(self, nodesinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodesinfo['request']['url']
        method = nodesinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodesinfo['name'])
        logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodesinfo', YamlUtil().read_testcase_yaml('v23.12/25_get_helm_chart_find.yaml'))
    def test_get_helm_chart_find(self, nodesinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodesinfo['request']['url']
        method = nodesinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodesinfo['name'])
        logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodesinfo', YamlUtil().read_testcase_yaml('v23.12/26_get_helm_chart&repo_find.yaml'))
    def test_get_helm_chartrepo_find(self, nodesinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodesinfo['request']['url']
        method = nodesinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodesinfo['name'])
        logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodesinfo', YamlUtil().read_testcase_yaml('v23.12/27_get_helm_chart_not_repo_find.yaml'))
    def test_get_helm_chart_not_repo_find(self, nodesinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodesinfo['request']['url']
        method = nodesinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodesinfo['name'])
        logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodesinfo', YamlUtil().read_testcase_yaml('v23.12/28_get_helm_chart_repo_find.yaml'))
    def test_get_helm_chart_repo_find(self, nodesinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodesinfo['request']['url']
        method = nodesinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodesinfo['name'])
        logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodesinfo', YamlUtil().read_testcase_yaml('v23.12/29_get_helm_chart_repo_verssion.yaml'))
    def test_get_helm_chart_repo_verssion(self, nodesinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodesinfo['request']['url']
        method = nodesinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodesinfo['name'])
        logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodesinfo', YamlUtil().read_testcase_yaml('v23.12/30_get_helm_chart_not_repo_ver.yaml'))
    def test_get_helm_chart_not_repo_ver(self, nodesinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodesinfo['request']['url']
        method = nodesinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodesinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 500

    @pytest.mark.parametrize('nodesinfo', YamlUtil().read_testcase_yaml('v23.12/31_get_helm_not_chart_repo_ver.yaml'))
    def test_get_helm_not_chart_repo_ver(self, nodesinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodesinfo['request']['url']
        method = nodesinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodesinfo['name'])
        logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodeinfo',YamlUtil().read_testcase_yaml('v23.12/32_get_helm_chart_version.yaml'))
    def test_get_helm_chart_version(self,nodeinfo,get_env_info):
        version = datas.version
        baseUrl = get_env_info
        url = baseUrl+nodeinfo['request']['url'].replace('{version}',version)
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method,url)
        logging.debug(nodeinfo['name'])
        logging.debug(json.loads(req.content))
        logging.debug(req.status_code)
        assert req.status_code == 200


    @pytest.mark.parametrize('nodeinfo',YamlUtil().read_testcase_yaml('v23.12/33_get_helm_chart_error_version.yaml'))
    def test_get_helm_chart_error_version(self,nodeinfo,get_env_info):
        baseUrl = get_env_info
        url = baseUrl+nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method,url)
        logging.debug(nodeinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 500

    @pytest.mark.parametrize('nodeinfo',YamlUtil().read_testcase_yaml('v23.12/34_get_helm_chart_error_repo.yaml'))
    def test_get_helm_chart_error_repo(self,nodeinfo,get_env_info):
        version = datas.version
        baseUrl = get_env_info
        url = baseUrl+nodeinfo['request']['url'].replace('{version}',version)
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method,url)
        logging.debug(nodeinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 500

    @pytest.mark.parametrize('nodeinfo',YamlUtil().read_testcase_yaml('v23.12/35_get_helm_chart_error_chart.yaml'))
    def test_get_helm_chart_error_chart(self,nodeinfo,get_env_info):
        version = datas.version
        baseUrl = get_env_info
        url = baseUrl+nodeinfo['request']['url'].replace('{version}',version)
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method,url)
        logging.debug(nodeinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 500

    @pytest.mark.parametrize('nodeinfo',YamlUtil().read_testcase_yaml('v23.12/36_get_helm_chart_chart.yaml'))
    def test_get_helm_chart_chart(self,nodeinfo,get_env_info):
        version = datas.version
        baseUrl = get_env_info
        url = baseUrl+nodeinfo['request']['url'].replace('{version}',version)
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method,url)
        logging.debug(nodeinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 200


    @pytest.mark.parametrize('nodeinfo',YamlUtil().read_testcase_yaml('v23.12/37_get_helm_repo_not_exist_chart.yaml'))
    def test_get_helm_repo_not_exist_chart(self,nodeinfo,get_env_info):
        version = datas.version
        baseUrl = get_env_info
        url = baseUrl+nodeinfo['request']['url'].replace('{version}',version)
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method,url)
        logging.debug(nodeinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 500

    @pytest.mark.parametrize('nodeinfo',YamlUtil().read_testcase_yaml('v23.12/38_get_helm_chart_not_exist_chart.yaml'))
    def test_get_helm_chart_not_exist_chart(self,nodeinfo,get_env_info):
        version = datas.version
        baseUrl = get_env_info
        url = baseUrl+nodeinfo['request']['url'].replace('{version}',version)
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method,url)
        logging.debug(nodeinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 500

    @pytest.mark.parametrize('nodeinfo',YamlUtil().read_testcase_yaml('v23.12/39_get_helm_chart_error_version_chart.yaml'))
    def test_get_helm_chart_error_version_chart(self,nodeinfo,get_env_info):
        version = datas.version
        baseUrl = get_env_info
        url = baseUrl+nodeinfo['request']['url'].replace('{version}',version)
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method,url)
        logging.debug(nodeinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 500

    @pytest.mark.parametrize('nodeinfo',YamlUtil().read_testcase_yaml('v23.12/40_get_helm_chart_releases.yaml'))
    def test_get_helm_chart_releases(self,nodeinfo,get_env_info):
        baseUrl = get_env_info
        url = baseUrl+nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method,url)
        logging.debug(nodeinfo['name'])
        #logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodeinfo', YamlUtil().read_testcase_yaml('v23.12/41_get_helm_chart_releases_not_exist_hub.yaml'))
    def test_get_helm_chart_releases_not_exist_hub(self, nodeinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodeinfo['name'])
        #logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 500

    @pytest.mark.parametrize('nodeinfo', YamlUtil().read_testcase_yaml('v23.12/42_get_helm_chart_releases_namespaces.yaml'))
    def test_get_helm_chart_releases_namespaces(self, nodeinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodeinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodeinfo', YamlUtil().read_testcase_yaml('v23.12/43_get_helm_chart_releases_not_exist_namespaces.yaml'))
    def test_get_helm_chart_releases_not_exist_namespaces(self, nodeinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodeinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 200


    @pytest.mark.parametrize('nodeinfo', YamlUtil().read_testcase_yaml('v23.12/44_get_helm_chart_releases_name.yaml'))
    def test_get_helm_chart_releases_name(self, nodeinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodeinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodeinfo', YamlUtil().read_testcase_yaml('v23.12/45_get_helm_chart_releases_not_exist_name.yaml'))
    def test_get_helm_chart_releases_not_exist_name(self, nodeinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodeinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodeinfo', YamlUtil().read_testcase_yaml('v23.12/46_get_helm_chart_release_status.yaml'))
    def test_get_helm_chart_release_status(self, nodeinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodeinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodeinfo', YamlUtil().read_testcase_yaml('v23.12/47_get_helm_chart_release_sortBy.yaml'))
    def test_get_helm_chart_release_sortBy(self, nodeinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodeinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 200

    @pytest.mark.parametrize('nodeinfo', YamlUtil().read_testcase_yaml('v23.12/48_get_helm_chart_release_name&namespaces.yaml'))
    def test_get_helm_chart_release_name(self, nodeinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodeinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 500

    @pytest.mark.parametrize('nodeinfo', YamlUtil().read_testcase_yaml('v23.12/49_get_helm_chart_release_not_exist_namespaces.yaml'))
    def test_get_helm_chart_release_not_exist_namespaces(self, nodeinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodeinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 500

    @pytest.mark.parametrize('nodeinfo', YamlUtil().read_testcase_yaml('v23.12/50_get_helm_chart_release_not_exist_cluster.yaml'))
    def test_get_helm_chart_release_not_exist_cluster(self, nodeinfo, get_env_info):
        baseUrl = get_env_info
        url = baseUrl + nodeinfo['request']['url']
        method = nodeinfo['request']['method']
        req = RequestUtil().send_request(method, url)
        logging.debug(nodeinfo['name'])
        logging.debug(req.text)
        logging.debug(req.status_code)
        assert req.status_code == 500






if __name__ == '__main__':
   pytest.main(['-vs'])